﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace DataCoreTechnologies.Scribe
{
    public partial class SplashScreen : Form
    {
        static SplashScreen s_SplashScreen = null;

        //Static Methods
        private static void ShowForm()
        {
            s_SplashScreen = new SplashScreen();
            Application.Run(s_SplashScreen);
        }
        public static void ShowSplashScreen()
        {
            if (s_SplashScreen != null)
                return;
            s_thread = new Thread(new ThreadStart(SplashScreen.ShowForm));
            s_thread.IsBackground = true;
            s_thread.SetApartmentState(ApartmentState.STA);
            s_thread.Start();
        }

        public static void CloseForm()
        {
            s_SplashScreen.Close();
        }

        //Events
        private void timer1_Tick(object sender, EventArgs e)
        {
            CloseForm();
        }

        //Constructor
        public SplashScreen()
        {
            InitializeComponent();
            timer1.Start();
        }

        private void SplashScreen_Load(object sender, EventArgs e)
        {
            this.ClientSize = this.BackgroundImage.Size;
        }

        //Properties
        static Thread s_thread = null;

    }
}
